package Top200;

/**
 * @author zhangmin
 * @create 2022-02-23 11:32
 */
public class lengthOfLastWord58 {
    public int lengthOfLastWord(String s) {
        String[] ss = s.split(" ");
        for (int i = ss.length-1; i >=0 ; i--) {
            if (ss[i].equals(" ")) continue;
            else {
                return ss[i].length();
            }
        }
        return 0;
    }
}
